<template>
  <div class="stepLengthWrapper">
    <div>设置分析步长</div>
    <!-- <div class="stepLength" v-if="$store.state.dataList.length === 1">
      <el-radio class="radioItem" v-model="radio" label="1">1</el-radio>
      <el-radio class="radioItem" v-model="radio" label="2">2</el-radio>
      <el-radio class="radioItem" v-model="radio" label="3">3</el-radio>
      <el-radio class="radioItem" v-model="radio" label="4">4</el-radio>
    </div>
    <div class="stepLength" v-else-if="$store.state.dataList.length === 2">
      <el-radio class="radioItem" v-model="radio" label="2">最短路径</el-radio>
      <el-radio class="radioItem" v-model="radio" label="3">3</el-radio>
      <el-radio class="radioItem" v-model="radio" label="4">4</el-radio>
      <el-radio class="radioItem" v-model="radio" label="5">5</el-radio>
      <el-radio class="radioItem" v-model="radio" label="6">
        自定义
      </el-radio>
      <el-form :model="dynamicStepForm" ref="dynamicStepForm" class="demo-dynamic">
        <el-form-item :prop="radio === '6' ? 'step' : null" :rules="rule">
          <el-input v-model.number="dynamicStepForm.step" clearable></el-input>
        </el-form-item>
      </el-form>
    </div> -->
    <div class="stepLength">
      <el-radio class="radioItem" v-model="radio" label="1">1</el-radio>
      <el-radio class="radioItem" v-model="radio" label="2">2</el-radio>
      <el-radio class="radioItem" v-model="radio" label="3">3</el-radio>
      <el-radio class="radioItem" v-model="radio" label="4">4</el-radio>
      <el-radio class="radioItem" v-model="radio" label="5">
        自定义
        <el-form :model="dynamicStepForm" ref="dynamicStepForm" class="demo-dynamic">
          <el-form-item :prop="radio === '5' ? 'step' : null" :rules="rule">
            <el-input v-model.number="dynamicStepForm.step" @input="con" clearable></el-input>
          </el-form-item>
        </el-form>
      </el-radio>
    </div>
  </div>
</template>

<script>
  export default {
    name: "sx-step-length",
    components: {},
    props: {
      // scaleRange: {
      //   type: Number,
      //   default: 1
      // },
    },
    data() {
      return {
        radio: "1",
        input: undefined,
        rule: [{
          type: 'number',
          message: '只能输入正整数',
          trigger: 'blur'
        }, ],
        dynamicStepForm: {
          step: ''
        }
      }
    },
    mounted() {

    },
    methods: {
      con() {
      }
    }
  }
</script>

<style lang="scss" scoped>
  // 单项选择器的样式
    /deep/ .el-radio__input.is-checked+.el-radio__label {
        height: 19px;
        font-size: 14px;
        color: #333333;
        line-height: 19px;
        }

        /deep/ .el-radio {
        color: #333333;

        .el-radio__inner {
            background: #fff;
            border-color: #B7BBC7;

            &::after {
            width: 10px;
            height: 10px;
            border-radius: 100%;
            background-color: #4B71EB;
            content: "";
            position: absolute;
            left: 50%;
            top: 50%;
            }
        }
    }
  .stepLengthWrapper {
    position: relative;

    div:nth-child(1) {
      text-align: left;
      height: 21px;
      font-size: 16px;
      color: #333333;
      line-height: 21px;
      margin-bottom: 16px;
    }

    .stepLength {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      // height: 150px;
      height: 120px;

      .radioItem {
        flex-grow: 1;
        margin-right: 0;
        text-align: left;
        display: inline-block;
        width: 180px;

        .demo-dynamic {
          position: absolute;
          left: 80px;
          top: -10px;

          /deep/ .el-input {
            margin: 0;
            font-size: 14px;

            span {
              display: inline-block;
              position: relative;
              left: -12px;
            }

            .el-input__inner {
              height: 32px;
              padding: 4px;
              padding-right: 20px;
            }
          }
        }
      }
    }
  }
</style>